package com.mcmaster.android;

import java.io.*;
import java.util.Scanner;
import java.util.Vector;

import com.mcmaster.android.data.Building;

import android.content.Context;

public class RawFileReader {
	
	Vector<Building> buildingDB = new Vector<Building>();
			
	public RawFileReader() {
	}
	
	public void readInFile(Context ctx, int resourceID) throws FileNotFoundException
	{
		InputStream read_in = ctx.getResources().openRawResource(resourceID);
		Scanner scanner = new Scanner(read_in);
		
		while (scanner.hasNextLine())
		{
			parseLine(scanner.nextLine());
		}
		
		scanner.close();
	}
	
	public void parseLine (String line)
	{
		Scanner scanner = new Scanner (line);
		scanner.useDelimiter(",");
		String name = null, info = null, location = null;
		if (scanner.hasNext()) 
		{
			name = scanner.next();
			info = scanner.next();
			location = scanner.next();
			//buildingDB.add(new Building(name, info, location));
		}
	}
}
